
@extends('admin.base.index')

@section('tables')      
<form action="" method="post" name="myform">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <input type="hidden" name="_method" value="delete">
</form>     
<div class="row">
<div class="col-sm-12">
    <section class="panel">
        <header class="panel-heading">
            用户列表
            
                <span class="tools pull-right">
                    <a href="/admin/user/create">添加用户</a>
                </span>
        </header>
        
        <div class="panel-body">
            <form action='/admin/user' method='get'>
                <input type="text" name="username" class="col-sm-2" style="height:30px">
                <input type="submit" value="搜索" style="margin-top:2px" >                     
            </form>
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>密码</th>
                    <th>确认密码</th>
                    <th>邮箱</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                @foreach($list as $v)
                    <td>{{ $v->id }}</td>
                    <td>{{ $v->username }}</td>
                    <td>{{ $v->password }}</td>
                    <td>{{ $v->passname }}</td>
                    <td>{{ $v->email }}</td>
                    <td>
                        <a href="javascript:doDel({{ $v->id }})">删除</a>|
                         <a href="/admin/user/{{ $v->id }}/edit">修改</a>|
                    </td> 
                </tr>
                
                </tbody>
                @endforeach
            </table>
            <script type="text/javascript">
                 function doDel(id)
                 {
                    if(confirm('确定要删除吗？')){
                         var form = document.myform;
                        form.action = '/admin/user/'+id;
                        form.submit();
                    }
                }
            </script>
            {{ $list->appends($where)->links() }}
        </div>
    </section>
</div>
@endsection